package net.greyar.single;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

import net.greyar.theory.Symbol;

public class Catalog {
	public static List<Symbol> getRules(String game) throws IOException {
        File file = new File(Catalog.class.getClassLoader().getResource(game + ".gdl").getPath());
		BufferedReader reader = new BufferedReader(new FileReader(file));
		StringBuilder gdl = new StringBuilder();
		while (reader.ready()) {
			gdl.append(reader.readLine().trim());
			gdl.append('\n');
		}
		return Symbol.parseMany(gdl.toString());
	}
}
